#include <iostream>
using namespace std;


int dfs(int n,int heavy,int sum,int k,int *a){
	if(sum == heavy)
		return 1;
	if(sum > heavy)
		return 0;
	int ans=0;
	for(int i=k;i<n;i++){
		ans += dfs(n,heavy,sum+a[i],i+1,a);
	}
	return ans;
}



int main(){
	int n,heavy=40;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	cout<<dfs(n,heavy,0,0,a);
	return 0;
}
